﻿@model Vcare.ViewModels.ViewModelMembershipCards

@{
    ViewBag.Title = "ListOfPurchasedMembers";
}

<h2>Purchased Members</h2>
<div class="spacer"></div>
<h3>Number of Memberships Available : @ViewBag.NumAvailableMembers</h3>
<div class="spacer"></div>
<table  class="listtable contactstable" cellspacing="0" cellpadding="0">
<thead>
<th  class="tableheader clickcolumn">Date Created</th>
<th  class="tableheader clickcolumn">User</th>
<th  class="tableheader clickcolumn">Price Purchased</th>
<th  class="tableheader clickcolumn">Sold On Price</th>
<th  class="tableheader clickcolumn">SME</th>
</thead>
@foreach (var item in Model.ListPurchasedMembers)
{
    <tr>
    <td>@item.DateCreated</td>
    <td>@item.User.UserName</td>
    <td>@item.Price</td>
    <td>@item.SoldOnPrice</td>
    <td>
    @if (item.AllocatedMember.Count==0)
    {
        @:&nbsp;
    }
    else
    {
        if (item.AllocatedMember.FirstOrDefault().Company!=null)
        {
            @item.AllocatedMember.FirstOrDefault().Company.Company
        }       
        else
        {
            @:&nbsp;            
        }
    }
    </td>
    </tr>
}
</table>
<div class="spacer"></div>
<div>
    @Html.ActionLink("Allocate", "Allocate", null, new { style="font-size: 16px;" })
</div>
<div class="spacer"></div>